package find;

import my.opencv.CascadeClassifierUtils;
import my.opencv.OpencvImageUtils;
import opencv.utils.InitUtils;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Rect;
import org.opencv.imgcodecs.Imgcodecs;

public class FindFaces {
    static {
        InitUtils.addLibrary();
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        //注意程序运行的时候需要在VM option添加该行 指明opencv的dll文件所在路径
        //-Djava.library.path=$PROJECT_DIR$\opencv\x64
    }
    public static void main(String[] args){
        String path="C:/Users/admin/Desktop/dsBuffer.bmp.png";
//        String path="C:/Users/admin/Desktop/shengfenzheng/do/paperResulrt.jpg";
//        String path="C:/Users/admin/Desktop/shengfenzheng/W020120329416036832722.jpg";
//        String path="C:/Users/admin/Desktop/shengfenzheng/fabai.jpg";
//        String path="C:/Users/admin/Desktop/cut/u=326162972,2676140621&fm=26&gp=0.jpg";
//        String path="C:/Users/admin/Desktop/shengfenzheng/962bd40735fae6cd23d01a1408b30f2442a70f5a.jpg";
//        String path="C:/Users/admin/Desktop/222.png";11
//        String path="C:/Users/admin/Desktop/cut/20200915093208.png";
//        String path= "C:/Users/admin/Desktop/cut/year.jpg";
//        Mat mat= Imgcodecs.imread(path,0);
        Mat mat= Imgcodecs.imread(path);

        Rect[] rects = CascadeClassifierUtils.findFaces(mat);
        Rect rect = OpencvImageUtils.getMixRect(rects);

        OpencvImageUtils.drawRect(rect,mat);
    }


}
